<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>发表评论</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>
</head>
<body>
    <header class="header">
        <div class="backPrevPage" onclick="historyBack()"></div>
        <div class="pageTitle">选择评论商品</div>
    </header>
    <section class="HTML_BOX">
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <ul class="plr chooseEva">
                <!-- <li class="wareInfo on">
                    <div class="wareImage">
                        <img src="../image/testsp.png" />
                    </div>
                    <div class="wareData">
                        <div class="radio"></div>
                        <div class="wareName">广西车厘子</div>
                        <div class="wareGuiGe">2kg<i></i></div>
                        <div class="warePrice">
                            <div><span class="prcie1">$62.00</span><del class="prcie2">$45.00</del></div>
                            <span class="count">x1</span>
                        </div>
                    </div>
                </li>
                <li class="wareInfo">
                    <div class="wareImage">
                        <img src="../image/testsp.png" />
                    </div>
                    <div class="wareData">
                        <div class="radio"></div>
                        <div class="wareName">广西车厘子</div>
                        <div class="wareGuiGe">2kg<i></i></div>
                        <div class="warePrice">
                            <div>
                            <span class="prcie1">$62.00</span>
                            <del class="prcie2">$45.00</del>
                            </div>
                            <span class="count">x1</span>
                        </div>
                    </div>
                </li> -->
            </ul>
            <div class="loginBtn f_c">确认选择评价商品</div>
    </section>
    
   
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
    var param = {};
    var list = [];
    var index = -1
    $(".loginBtn").click(function(){
        if(index<0){
            if(cnen==1){
                pop.notice("请选择一个商品进行评价");
            }else{
                 pop.notice("Please select a commodity for evaluation.");
            }
            return;
        }
         openWin('publicEva','publicEva.html',{order_id:param.order_id,info:list[index]});
    })
    function go_eva(e,id){
        $(".wareInfo").removeClass("on");
        $(e).addClass("on");
        index = id;
    }
    apiready = function(){
        $api.fixStatusBar($api.dom('header'));
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        api.addEventListener({
            name: 'eva'
        }, function(ret, err) {
           ready();
        });
        ifCnAndEn();
        param = api.pageParam;
        ready();
    };
    
    function ready(){
        getAjax(Interface.product_by_order,{token:token,order_id:param.order_id},function(res){
            list = res.data;
            console.log(JSON.stringify(res));
            $(".chooseEva").empty();
            $.each(res.data,function(i,item){
                var name = '';
                if(cnen==1){
                    name = item.title;
                }else{
                    name = item.egname;
                }
                var html ='<li onclick="go_eva(this,'+i+')" class="wareInfo">';
                    html+='<div class="wareImage">';
                        html+='<img src="'+getImg(item.icon)+'" />';
                    html+='</div>';
                    html+='<div class="wareData">';
                        html+='<div class="radio"></div>';
                        html+='<div class="wareName"><span>'+name+'</span></div>';
                        // html+='<div class="wareGuiGe">2kg<i></i></div>';
                        html+='<div class="warePrice">';
                            html+='<div>';
                            if(item.old_price == ""){
                                html+='<span class="prcie1">$'+item.new_price+'</span>';
                            }else{
                                html+='<span>$'+item.new_price+'</span>';
                                html+='<del class="prcie2">'+item.old_price+'</del>';
                            }
                            html+='</div>';
                            html+='<span class="count">x'+item.num+'</span>';
                        html+='</div>';
                    html+='</div>';
                html+='</li>';
                $(".chooseEva").append(html);
            })
        },function(res,err){})
    }
</script>
<script type="text/javascript">
    function ifCnAndEn(){
        if(cnen==2){
           $(".pageTitle").html("Reviews");
           $(".loginBtn").html('Review');
        }
    }
</script>
</html>